//
//  CarNavigateItem.m
//  SecondPage
//
//  Created by winston on 13-4-10.
//  Copyright (c) 2013年 winston. All rights reserved.
//

#import "CarNavigateItem.h"

@implementation CarNavigateItem
@synthesize moduleKey;

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        backgroundView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, frame.size.width,frame.size.height )];
        [self addSubview:backgroundView];
        [backgroundView release];
        [backgroundView setImage:[UIImage imageNamed:@"AllAuto_Button_Items_Unselect_BG"]];
        
        titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, 100, frame.size.height)];
        titleLabel.backgroundColor = [UIColor clearColor];
        titleLabel.textAlignment = NSTextAlignmentLeft;
        titleLabel.font = [UIFont fontWithName:@"Arial" size:15];
        [self addSubview:titleLabel];
        [titleLabel release];
        
//        markLabel = [[UILabel alloc] initWithFrame:CGRectMake(125, 10, 20, 20)];
//        markLabel.backgroundColor = [UIColor clearColor];
//        markLabel.textAlignment = NSTextAlignmentLeft;
//        markLabel.font = [UIFont fontWithName:@"Arial" size:25];
//        [self addSubview:markLabel];
//        [markLabel release];
    }
    return self;
}


-(void)setSelected:(BOOL)selected
{
    [super setSelected:selected];
    if(selected)
    {
        [backgroundView setImage:[UIImage imageNamed:@"AllAuto_Button_Items_Select_BG"]];
        [titleLabel setTextColor:[UIColor whiteColor]];
//        [markLabel setTextColor:[UIColor whiteColor]];
//        [markLabel  setText:@"。"];
    }
    else
    {
        [backgroundView setImage:[UIImage imageNamed:@"AllAuto_Button_Items_Unselect_BG"]];
        [titleLabel setTextColor:[UIColor blackColor]];
//        [markLabel setTextColor:[UIColor blackColor]];
//        [markLabel  setText:@">"];
    }
}


-(void)loadData:(NSDictionary*)data
{
    [titleLabel setText:[data objectForKey:@"Title"]];
//    [markLabel setText:[data objectForKey:@">"]];
}

@end
